#include <iostream>

using namespace std;

class Aa
{
public:
  Aa(char e) : aa{e} {};
  virtual void pnt() noexcept { cout << " hello Aa: aa = " << aa << "\n"; }
  virtual ~Aa(){};

private:
  // 这个私有数据无论是double 或者 int or char， 一个对象均占用16个字节，内存对齐产生的结果
  // 指向虚函数表的指针放在数据的后面
  char aa;
};

class Bb : public Aa
{
  int bb;

public:
  Bb(char c, int d) : Aa{c}, bb{d} {};
  void pnt() noexcept override { cout << "hello Bb:  bb =" << bb << "\n"; }
  // Aa定义的指针不能调用 cc 函数
  void cc() {cout << "okay\n";}
  ~Bb(){};
};

int main()
{
  Aa *a;
  cout << sizeof(Aa) << "\n";
  cout << sizeof(Bb) << "\n";
  cout << sizeof(int) << "\n";
  a = new Bb{1, 2};
  a->pnt();
  // a->cc();
  return 0;
}